\section{Drivers}

\begin{frame}
  \frametitle{Clock}
  Linux host maintains three kinds of clocks for each of its processes:
  \begin{enumerate}
    \item Real Timer: actual elapsed time; SIGALRM recieved.
    \item Virtual Timer: time spent by the process in user mode; SIGVTALRM recieved.
    \item Profile Timer: time spent by the process both in user and in kernel mode; SIGPROF recieved.
  \end{enumerate}

  Virtual timer is used in UML.
  \newline \newline
  Syscalls needed: setitimer(104), sigaction(67).
\end{frame}

\begin{frame}
  \frametitle{Disk (IDE)}
  A file on the host is regarded as a disk if specified in command line (normal partitions, swap fs, etc).
  \newline \newline
  Syscalls needed: open(5), close(6), read(3), write(4), lseek(19).
\end{frame}

\begin{frame}
  \frametitle{intr}
  Interrupts to UML are signals to the host. So disabling interrupts is implemented as masking related signals.
  \newline \newline
  Syscalls needed: sigprocmask(126), sigpending (73).
\end{frame}

\begin{frame}
  \frametitle{Console}
  The terminal is used (i.e. /dev/tty). Reading from the file corresponds to 'in' and writing to the file means 'out'.
  \newline \newline
  Some properties of the terminal is set when initializing to simulate a 'raw' console using syscall 'ioctl' (no echo, no buffer, etc.)
  \newline \newline
  A thread is applied to read every character and raise a SIGIO to simulate an interrupt generated by devices in proj4 using pthread.
  May reimplemented by asynchronous IO later (but aio is not accessible by int \$0x80)?
  \newline \newline
  Syscalls needed: ioctl(54), open(5), close(6), read(3), write(4).
\end{frame}